home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.3 Development Libraries / SGI IRIX 6.3 Development Libraries.iso / dist6.3 / ViewKit_dev.idb / usr / include / Vk / VkModified.h.z / VkModified.h
Encoding:
C/C++ Source or Header  |  1996-09-20  |  4.5 KB  |  137 lines

  1. ////////////////////////////////////////////////////////////////////////////////
  2. ///////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
  3. //                                                                            //
  4. // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;     //
  5. // the contents of this file may not be disclosed to third parties, copied    //
  6. // or duplicated in any form, in whole or in part, without the prior written  //
  7. // permission of Silicon Graphics, Inc.                                       //
  8. //                                                                            //
  9. // RESTRICTED RIGHTS LEGEND:                                                  //
  10. // Use,duplication or disclosure by the Government is subject to restrictions //
  11. // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data     //
  12. // and Computer Software clause at DFARS 252.227-7013, and/or in similar or   //
  13. // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -    //
  14. // rights reserved under the Copyright Laws of the United States.             //
  15. //                                                                            //
  16. ////////////////////////////////////////////////////////////////////////////////
  17. #ifndef _VK_MODIFIED_
  18. #define _VK_MODIFIED_
  19.  
  20. #include <X11/Intrinsic.h>
  21. #include <Vk/VkCallbackObject.h>
  22.  
  23. enum VkModifiedReason { VM_activate, VM_valueChanged };
  24.  
  25. typedef struct {
  26.   VkModifiedReason reason;
  27.   class VkModified *obj;
  28.   XEvent *event;
  29. } VkModifiedCallback;
  30.  
  31. class VkModified : public VkCallbackObject {
  32.  
  33.   public:
  34.  
  35.     VkModified(Boolean blankIsValue = False);
  36.     virtual ~VkModified();
  37.  
  38.     Boolean blankIsValue() { return _blankIsValue; }
  39.     Boolean modified() { return _modified; }
  40.     virtual void setModified(Boolean v);
  41.  
  42.     Boolean latestDisplay() { return _latest; }
  43.     virtual void toggleDisplay();
  44.  
  45.     char *value() { return _value; }
  46.     char *previousValue() { return _previousValue; }
  47.     virtual void setValue(const char *v);
  48.  
  49.     virtual void fixPreviousValue(char *v, Boolean setValueAlso = True);
  50.  
  51.   protected:
  52.  
  53.     void updateModified();
  54.  
  55.     Boolean _modified, _latest;
  56.     Dimension _width, _height;
  57.     char *_value, *_previousValue;
  58.     Boolean _blankIsValue, _fixedPrevious;
  59. };
  60.  
  61. class VkModifiedAttachment : public VkModified {
  62.  
  63.   public:
  64.  
  65.     static const char *const modifiedCallback;
  66.     
  67.     VkModifiedAttachment(Boolean blankIsValue = False,
  68.              Boolean autoAdjust = True,
  69.              Boolean incrementalChange = False);
  70.     ~VkModifiedAttachment();
  71.     
  72.     virtual void setModified(Boolean v);
  73.     virtual void toggleDisplay();
  74.     virtual void setValue(const char *v);
  75.     virtual void fixPreviousValue(char *v, Boolean setValueAlso = True);
  76.     
  77.     virtual void setParameters(Dimension width, Dimension height);
  78.     void getParameters(Dimension *width, Dimension *height);
  79.     
  80.     Widget widget() { return _w; }
  81.     Boolean autoAdjust() { return _autoAdjust; }
  82.     
  83.     void attach(Widget w);
  84.     void detach();
  85.     
  86.     void show();
  87.     void hide();
  88.     
  89.     void expose();
  90.     void displayValue();
  91.     
  92.     void adjustGeometry();
  93.     
  94. protected:
  95.     void buildWindow(Widget w);
  96.     void reparentWindow(Widget w);
  97.     void adjustWindow();
  98.     void forceExpose();
  99.     void setCursor();
  100.     void setWidgetValue(Widget w, char *v);
  101.     char *getWidgetValue(Widget w);
  102.     void setupCallbacks(Widget w);
  103.     void removeCallbacks(Widget w);
  104.     void drawCornerShadows(Pixel shadow1, Pixel shadow2, Boolean etched);
  105.     void callCallback(VkModifiedReason reason, XEvent *event = NULL);
  106.     void updateDisplay();
  107.     
  108.     static void reconfig_stub(Widget w, XtPointer client_data, XEvent *ev,
  109.                   Boolean *dispatch);
  110.     static void expose_stub(Widget w, XtPointer client_data,
  111.                 XtPointer call_data);
  112.     static void input_stub(Widget w, XtPointer client_data,
  113.                XtPointer call_data);
  114.     static void destroy_stub(Widget w, XtPointer client_data,
  115.                  XtPointer call_data);
  116.     static void activate_stub(Widget w, XtPointer client_data,
  117.                   XtPointer call_data);
  118.     static void value_stub(Widget w, XtPointer client_data,
  119.                XtPointer call_data);
  120.     
  121.     Display *_dpy;
  122.     Widget _w, _parent, _area;
  123.     Pixel _bg, _fg, _topShadow, _bottomShadow, _parentBg;
  124.     GC _gc;
  125.     Dimension _shadow, _highlight;
  126.     Cursor _cursorBack, _cursorForward;
  127.     Boolean _shown;
  128.     unsigned char _shadowType;
  129.     Boolean _inhibitCallback;
  130.     Boolean _displayModified;
  131.     Boolean _incrementalChange;
  132.     Boolean _inhibitUpdate;
  133.     Boolean _autoAdjust;
  134. };
  135.  
  136. #endif
  137.